package br.eti.robsonfranca.clf4j.javase;

import java.io.InputStream;
import java.io.PrintStream;

import br.eti.robsonfranca.clf4j.impl.BasicUI;
import br.eti.robsonfranca.clf4j.impl.DirectConsoleImpl;
import br.eti.robsonfranca.clf4j.impl.win.WinConsoleImpl;
import br.eti.robsonfranca.clf4j.interfaces.Console;
import br.eti.robsonfranca.clf4j.interfaces.UITools;

import com.google.inject.AbstractModule;

public class ConsoleModule extends AbstractModule {
	@Override
	protected void configure() {
		String os = System.getProperty("os.name");
		if (os.startsWith("Windows")) {
			bind(Console.class).to(WinConsoleImpl.class);
		} else {
			bind(Console.class).to(DirectConsoleImpl.class);
			bind(InputStream.class).toInstance(System.in);
			bind(PrintStream.class).toInstance(System.out);			
		}
		bind(UITools.class).to(BasicUI.class);
	}
}
